package com.yy.wga.order.service.task;

import com.yy.wga.common.util.aop.DistributedLock;
import com.yy.wga.order.service.manager.OrderSettleManager;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @Author: gc
 * @Date: 2024/10/30
 * @Description:
 **/
@Slf4j
@RequiredArgsConstructor
@Component
public class OrderSettleTask {
    private final OrderSettleManager orderSettleManager;


    /**
     * 每个月25号结算上个月订单
     */
    @Scheduled(cron = "30 25 0 25 * *")
    @DistributedLock(value = "'orderSettle'")
    public void orderSettle() {
        log.info("开始结算收益");
        orderSettleManager.orderSettle();
        log.info("结算收益完成");
    }
}
